package net.xo68.destiny.contract.enums.user;

/**
 * 用户状态枚举
 * @author wuxie
 * @version 2020-11-7
 */
public enum UserStateEnum {

    LOCK(0,"锁定"),
    ENABLE(1,"正常"),
    DELETE(2,"删除"),
    UNKNOWN(9,"未知");

    private final int code;
    private final String tag;

    UserStateEnum(int code, String tag) {
        this.code = code;
        this.tag = tag;
    }

    public int getCode() {
        return code;
    }

    public String getTag() {
        return tag;
    }

    public static UserStateEnum of(int code){
        for (UserStateEnum recordType: UserStateEnum.values()){
            if(code == recordType.getCode()){
                return recordType;
            }
        }
        return UserStateEnum.UNKNOWN;
    }
}
